<script type="text/javascript" src="<?php echo js_link("order.js","admin");?>"></script>
<h1>My customer</h1>
    <div class="toppage">
    	<span class="left">
        	<select style="width:130px;">
            	<option value="1">Action</option>
                <option value="2">Edit</option>
                <option value="3">Delete</option>
            </select>
            <input type="submit" name="" value="Apply" class="btn" />
            <input type="text" name="" value="Keyword" style="width:165px; padding:3px;" />
            <select style="width:130px; line-height:25px;">
            	<option value="1">ID Customer</option>
                <option value="2">Customer name</option>
            </select>
            <input type="submit" name="" value="Filter" class="btn" />
        </span>
        <input type="hidden" name="base_url" id="base_url" value="<?php echo admin_url("customer/my_order_create");?>" />
        <?php if($this->module_model->check_action($_SESSION['_admin']['group_id'],$this->router->class,'customers_create')):?>
        <span class="btnadd"><a href="javascript:void(0)" id="add_new_customer" onclick ="">Add new customer</a></span>
        <?php endif;?>
        
        <?php if($this->module_model->check_action($_SESSION['_admin']['group_id'],$this->router->class,'my_order_create')):?>
        <span class="btnadd"><a href="javascript:void(0)" id="add_new_order" onclick ="">Add new order</a></span>
        <?php endif;?>
        
        <!-- <input type="submit" name="cmdAdd" style="background-color:#CCC;" value="Add new customer" class="btn" id="add_new_customer" />
        <input type="submit" name="cmdAdd" style="background-color:#CCC;" value="Add new order" class="btn" id="add_new_order" /> -->
        <span class="right">
        </span>
    </div>
    
    <div class="topart">
    
    	<span class="left">
    		<font class="number">(<?php echo $total_order;?>)</font> <a href="<?php echo admin_url("customer/my_order");?>">All Oder</a><font class="line">|</font>
			<?php 
				foreach($per as $key=>$value_item):
			?>
			<font class="number">(<?php echo $value_item;?>)</font> <a href="<?php echo admin_url("customer/my_order?pay_stt=".str_replace(' ', '_', $key));?>"><font color="#0b9901"><?php echo $key;?></font></a><font class="line">|</font>
			<?php endforeach;?>
        </span>
        
        
        <span class="right1">
        	<select style="width:50px;">
            	<option value="1">30</option>
                <option value="2">50</option>
                <option value="3">100</option>
            </select>
            <div class="pagination">
<?php 
			echo $pagnav;
?>
            </div>
        </span>
        
    </div>
    <form action="<?php echo admin_url('customer/my_order')?>" method="post">
    <div class="tableout">
		<div class="title1">
        	<div class="column" style="width:2%;"><input type="checkbox" name="" value="" /></div>
            <div class="column" style="width:8%;">Oder ID</div>
            <div class="column" style="width:22%;">Customer Name</div>
            <div class="column" style="width:18%;">Tour Code - City</div>
            <div class="column" style="width:5%;">Price</div>
            <div class="column" style="width:8%;">Oder date</div>
            <div class="column" style="width:18%;">Country</div>
            <div class="column" style="width:10%;">Admin</div>
            <div class="column" style="width:8%;">Status</div>
        </div>
         <!-- List -->
<?php 
		$i = 0;
		foreach($list_order as $order)
		{
?>
		<div class="linecate2">
        	<div class="column" style="width:2%;"><input type="hidden" name="o_id[]" value="<?php echo $order['id'];?>" /><input type="checkbox" name="order_id[]" id="order_id[]" value="<?php echo $order["id"];?>" <?php echo set_checkbox('order_id', $order["id"]); ?> /></div>
            <div class="column" style="width:8%;"><a href="#"><?php echo $order["id"];?></a></div>
            <div class="column" style="width:22%;" onmouseover="Hovercat('<?php echo $i;?>')" onmouseout="Outcat('<?php echo $i;?>')">
            	<a href="javascript:void(0);" onclick ="view_my_order('<?php echo admin_url('customer/my_order_view?order_id='.$order['id'].'&view=yes')?>', <?php echo $order['id'];?>)" class="art"><?php echo trim($order["title"]). " " . trim($order["fullname"]);?></a><br />
                <div class="action" id="neocat-<?php echo $i;?>">
                    <a href="javascript:void(0)" onclick ="view_my_order('<?php echo admin_url('customer/my_order_view?order_id='.$order['id'].'&view=yes')?>', <?php echo $order['id'];?>)">Detail</a>
                    <?php if($this->module_model->check_action($_SESSION['_admin']['group_id'],$this->router->class,'my_order_edit')):?>
                    <a href="<?php echo admin_url('customer/my_order_edit?order_id='.$order['id'])?>">Edit</a>
                    <?php 
                    endif;
                    if($this->module_model->check_action($_SESSION['_admin']['group_id'],$this->router->class,'my_order_del')):
                    ?>
                    <a href="<?php echo admin_url('customer/my_order_del?order_id='.$order['id'])?>" onclick="return confirm('Are you sure?');">Delete</a>
                    <?php 
                    endif;
                    ?>
                    
                    <a href="#" id="contactLink<?php echo $i;?>">Add note</a>

                    <script type="text/javascript">
                    $(document).ready(function(){
						$("#contactLink<?php echo $i;?>").click(function(){
							$('#light').show();
							$('#fade').show();
							$('#content').load('<?php echo admin_url('customer/add_note?order_id='.$order['id']);?>');
						});
					});
                    </script>
                </div>
            </div>
            <div class="column" style="width:18%;">
            	<a href="<?php echo admin_url('tour/edit?id='.$order['tour_id']);?>" class="art"><?php echo $order["code"];?></a> - <?php echo $order["destination"];?>
            </div>
            <div class="column" style="width:4%;">
            	<font color="#FF0000">$<?php echo $order["total_price"];?></font>
            </div>
            <div class="column" style="width:8%;">
            	<?php echo time_format($order["date_create"], "day");?>
            </div>
            <div class="column" style="width:18%;">
            	<?php echo $order["country"];?> - <font color="#777"><?php echo $order["ip_address"];?></font>
            </div>
            <div class="column" style="width:9%;"><?php echo $order["user_process"];?></div>
            <div class="column" style="width:9%;">
            	<?php if($_SESSION['_admin']['group_id'] == 5):?>
            	<?php echo $order["pay_status"];?>
            	<?php else:?>
            	<select name="pay_status[]">
            	<?php 
            	foreach($per as $key=>$value)
            	{
            	?>
            	<option value="<?php echo $key;?>" <?php echo ($order["pay_status"]==$key) ? "selected" : "";?>><?php echo $key;?></option>
            	<?php 
            	}
            	?>
            	</select>
            	<?php endif;?>
            </div>
        </div>
<?php 
			$i++;
		}
?>        
        <div class="bottom1">
        	<div class="column" style="width:2%;"><input type="checkbox" name="" value="" /></div>
            <div class="column" style="width:50%;">
            	<select style="width:130px;" name="act">
                    <option value="">Action</option>
                    <option value="1">Update status</option>
                    <option value="2">Delete</option>
                </select>
                <input type="submit" name="" value="Apply" class="btn" />
            </div>
            <span class="right1">
                <div class="pagination">
<?php 
			echo $pagnav;
?>
                </div>
            </span>
        </div>
    </div>
    </form>
<div id="light" class="white_content">
	<div class="editart_top">
		<span class="left3">
		<h2>Edit customer</h2>
	    </span>
		<a href="javascript:void(0)" onclick ="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'"><img src="<?php echo img_link("close.png", "admin")?>" class="png" /></a>
    </div>
    <script type="text/javascript">
    	function check()
    	{
        	if($('#msg').val() == '')
        	{
            	alert('You must input msg.');
            	return false;
        	}
    	}
    
    </script>
    <form action="<?php echo admin_url('customer/add_note')?>" method="post" id="edit_cus" onsubmit="return check();">
		<div class="contactForm2" id="content">
			
		    
		</div>
		<div class="btarticle">
			<input type="text" name="msg" value="" id="msg" style="width:60%;" />
	        <input type="submit" name="" value="Add note" class="btn" style="float:left;" />
	    </div>
	</form>
</div>
<div id="fade" class="black_overlay"></div>